FROM docker.1ms.run/python:3.13-slim

COPY . /app
WORKDIR /app

ARG APP_VERSION
RUN if [ -n "$APP_VERSION" ]; then \
    printf '%s' "$APP_VERSION" > /app/version; \
    fi

ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV APP_VERSION=${APP_VERSION}

RUN pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
RUN pip cache purge

EXPOSE 21114

VOLUME ["/app/logs", "/app/data"]

RUN chmod +x start.sh

CMD ["./start.sh"]
